﻿package net.wangit.dev;

import java.util.ArrayList;
import java.util.List;

import net.wangit.context.ActionContext;
import net.wangit.dev.version.OutputMode;
import net.wangit.dev.version.Version;
import net.wangit.etl.ETLUtil;
import net.wangit.framework.config.ConsoleSettings;


public class VersionUtil {

	private VersionUtil() {
	}

	public static void saveVersion(ActionContext ac, Version version,
			String domain, String id) throws Exception {
		if (ConsoleSettings.instance().isAutoSaveVersion()) {
			List<String> ids = new ArrayList<String>();
			ids.add(id);
			String batchId = ETLUtil.getBatchId(ac);
			version.save(OutputMode.OBJECT, domain, batchId, ids);
		}
	}
}
